import Router from 'vue-router'
import Home from '@/components/pages/home'
import Mine from '@/components/pages/mine'
import MineOrder from '@/components/pages/mineOrder'
import HistoryOrders from '@/components/pages/historyOrders'
import ShoppingCart from '@/components/pages/shoppingCart'
import Draw from '@/components/pages/draw'

/* 修復導航報錯問題 */
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export const router = new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/mine',
      name: 'Mine',
      component: Mine
    },
    {
      path: '/history-orders',
      name: 'HistoryOrders',
      component: HistoryOrders
    },
    {
      path: '/mine-order',
      name: 'MineOrder',
      component: MineOrder
    },
    {
      path: '/shopping-cart',
      name: 'ShoppingCart',
      component: ShoppingCart
    },
    {
      path:'/draw',
      name:'Draw',
      component: Draw
    }
  ]
})
